package game.Screens;

import game.ActionListener;
import game.Game;
import game.Config.Config;
import game.Config.Config.GameInput;
import game.Menus.TextMenuItem;
import game.Menus.TextPictureItem;
import game.Menus.VerticalMenu;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;

/**
 * This screen presents the help to the player.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class HelpScreen extends Screen{
	VerticalMenu menu = new VerticalMenu(0,Config.HELP_MENU_GAP);
	@Override
	/**
	 * Initializes the screen.
	 */
	public void begin() {
		menu.addItem(new TextPictureItem("Objective","Your objective is to protect your eggs from vicious monsters.\n ",Config.helpObjectiveImage,Config.HELP_INFO_POSITION,Config.HELP_INFO_OFFSET,new ActionListener() {
			@Override
			public void action() {
				
			}
		}));
		menu.addItem(new TextPictureItem("The enemy","These are the monsters threating your eggs. \n Show them no mercy!",Config.helpEnemyImage,Config.HELP_INFO_POSITION,Config.HELP_INFO_OFFSET,new ActionListener() {
			@Override
			public void action() {
				
			}
		}));
		menu.addItem(new TextPictureItem("Moving","This is you. To move, use the WASD keys",Config.helpMoveImage,Config.HELP_INFO_POSITION,Config.HELP_INFO_OFFSET,new ActionListener() {
			@Override
			public void action() {
				
			}
		}));
		menu.addItem(new TextPictureItem("Shooting","To shoot, press the SPACE-key.\n You will always shoot in the direction of your mouse.",Config.helpShootImage,Config.HELP_INFO_POSITION,Config.HELP_INFO_OFFSET,new ActionListener() {
			@Override
			public void action() {
				
			}
		}));
		menu.addItem(new TextPictureItem("Building","When facing an empty grass patch, you will be able \nto build a tower. To do this, press B. \nWhen facing an already occupied grass patch, you will have \nthe option of upgrading that tower. Press B again to do this.",Config.helpBuildImage,Config.HELP_INFO_POSITION,Config.HELP_INFO_OFFSET.copy().scale(2),new ActionListener() {
			@Override
			public void action() {
				
			}
		}));
		menu.addItem(new TextPictureItem("Money","When you slay a monster they will drop some gold. \nTo pick it up, simply step on the gold.",Config.helpMoneyImage,Config.HELP_INFO_POSITION,Config.HELP_INFO_OFFSET,new ActionListener() {
			@Override
			public void action() {
				
			}
		}));
		menu.addItem(new TextMenuItem("Quit", new ActionListener() {
			@Override
			public void action() {
				quitAction();
			}

		}));
	}

	@Override
	public void end() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(GameContainer gc, int delta) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * Draws the screen.
	 */
	@Override
	public void draw(Graphics graphic) {
		menu.draw(Config.HELP_MENU_POSITION.copy(), graphic);
	}

	/**
	 * Check all the new input presses.
	 */
	@Override
	public void inputPressed(GameInput input) {
		if(input == GameInput.UP){
			menu.up();
		}
		if(input == GameInput.DOWN){
			menu.down();
		}
		if(input == GameInput.ACTION){
			menu.press();
		}
	}

	@Override
	public void inputDown(GameInput input) {
		// TODO Auto-generated method stub
		
	}
	
	protected void quitAction() {
		Game.screenStack.pop();
	}


}
